package givenchy

class Task {
	String name // task名字
	Boolean available = true //是否可用
	Integer seek =1 //权重

	TaskGroup taskGroup;//隶属的组
	User person //隶属用户
	String actions = ''//动作
	static belongsTo = TaskGroup


    static constraints = {
        name()
        seek()
        actions(size:0..1000) 
    } 

    String buildScript(){ 
        return actions.replace('\r\n', "|")
    }

    String toString(){
        name
    }
//    String toColor(){
//        int namesum = 0
//        if (name) {
//            name.each{
//                namesum = it.charAt(0)
//            }
//        }
//        def random = new Random(namesum)
//        
//        return Integer.toHexString(random.nextInt(255)) + Integer.toHexString(random.nextInt(255)) + Integer.toHexString(random.nextInt(255))
//    }

  
}
